/*
---
name: MPG.SwipeControl

description:

license: MIT-style

authors:
- Noritaka Horio

requires:
  - Core/Core
  - Core/Function
  - Core/Element
  - Core/Element.Event
  - Core/Class
  - Core/Class.Extras
  - Custom-Event/Element.defineCustomEvent
  - Mobile/Browser.Features.Touch
  - Mobile/Swipe

provides: [MPG.SwipeControl]

...
*/
(function($){

	var MPG = this.MPG = (this.MPG || {});

	MPG.SwipeControl = new Class({

		Implements: [MPG.Control],

		initialize: function(options){
			this.setOptions(options);
		},

		_onSwipe: function(event){
			switch(event.direction){
				case 'left':
					this.controller.next();
				    break;
				case 'right':
					this.controller.prev();
				    break;
			}
		},

		initControl: function(){
			var self = this;
			var body = document.body;
			body.addEvent('swipe', this._onSwipe.bind(self));
		}

	});

}(document.id));
